<?php

/*

Forums: Search Forums (search_forums.pro.php)

*/
ob_start();
$interactive = 1;
$rank_check = 3;
$page_title = "Last 50";
include "header.inc.php";

if ($search_type == "contain")
{
	$topics = mysql_query("SELECT * FROM forum_subjects2 WHERE subject LIKE '%$search_for%' AND game = '$game' ORDER BY last_post_at DESC LIMIT 50");
}
if ($search_type == "exact")
{
	$topics = mysql_query("SELECT * FROM forum_subjects2 WHERE subject = '$search_for' AND game = '$game' ORDER BY last_post_at DESC LIMIT 50");
}

while ($array = mysql_fetch_array($topics))
{
	if ($rank >= 4) { $delete = " | <a href=forum_delete.pro.php?game=$game&topic=$array[id]>Delete</a>"; }
	$cellcolor = alternate($cellcolor,"$reallyLight","#FFFFFF");
	$get_author = fetch("SELECT username,display_name FROM members2 WHERE id = '$array[author]' AND game = '$game'");
	$get_responder = fetch("SELECT username,display_name FROM members2 WHERE id = '$array[last_post_by]' AND game = '$game'");
	$lastpost_string = date("H:i:s, M j",$array[last_post_at]);
	$topic_list .= "<tr bgcolor=$cellcolor onmouseover=\"this.style.background='$middleBG';\" onmouseout=\"this.style.background='$cellcolor';\" width=100%><td width=100%><p><a href=$base_url/view_topic.php?game=$game&id=$array[id]>$array[subject]</a> ($array[num_replies] replies$delete)<br><font size=-1><i><a href=$base_url/user_profile.php?game=$game&user=$get_author[username]>$get_author[display_name]</a></i></font></p></td><td width=100><p><font size=-1><i>Last&nbsp;post&nbsp;by:<br><a href=user_profile.php?game=$game&user=$get_responder[username]>$get_responder[display_name]</a></i></font></p></td><td width=100><p><font size=-1><i>At&nbsp;$lastpost_string</i></font></p></td></tr>";
}

echo $openHTML;

$findPage = fetch("SELECT * FROM game_pages WHERE page_title = 'Forums' AND game = '$game'");
if (!$findPage[id])
{
	print "<p><b>Welcome to the forums. Failure to obey the following rules may result in suspension of your account.<br><font color=red>1. Keep it clean, anything over PG will be deleted.</font></b></p>";
}
else
{
	print "$findPage[page_info]";
}

ECHO <<<END

<style><!--
A:link.forum {
text-decoration:  none;
color: #009900;
}
A:visited.forum {
text-decoration:  none;
color: #009900;
}
A:hover.forum {
text-decoration:  none;
color: #009900;
}
A:active.forum {
text-decoration:  none;
color: #009900;
}
--></style>

<CENTER><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH="300">
   <TR>
      <TD COLSPAN=4>
         <CENTER><FONT COLOR="#009900"><B>.:<a href=forums.php?game=$game class=forum>$gameName2
         Forums</a> - Search Forums:.</B><BR>
         </FONT><TABLE CELLSPACING=0 CELLPADDING=0 WIDTH="90%">
            <TR>
               <TD>
                  <CENTER><a href=add_topic.php?game=$game><IMG SRC="images/design/in/add_topic.gif" WIDTH=60 HEIGHT=20></a></CENTER>
               </TD>
               <TD>
                  <CENTER><a href=your_topics.php?game=$game><IMG SRC="images/design/in/your_topics.gif" WIDTH=65 HEIGHT=20></a></CENTER>
               </TD>
               <TD>
                  <CENTER><a href=last_50.php?game=$game><IMG SRC="images/design/in/last_50.gif" WIDTH=85 HEIGHT=20></a></CENTER>
               </TD>
               <TD>
                  <CENTER><a href=search_forums.php?game=$game><IMG SRC="images/design/in/search.gif" WIDTH=60 HEIGHT=20></a></CENTER>
               </TD>
            </TR>
         </TABLE>
         </CENTER>
      </TD>
   </TR>
</TABLE>

<CENTER><BR> <TABLE BGCOLOR="$tableOutline" CELLSPACING=1 CELLPADDING=0 WIDTH=95%>

<tr bgcolor=$tableOutline><td width=100% colspan=3><p>Regular Posts:</p></td></tr>$topic_list</table>

END;

echo $closeHTML;

?>